import request from '@/utils/request'
import store from '../../store'
import { transformQueryCondition } from '@/utils'
const subSysPrefix = '/bussSys'

export function systemUserCompositeSelect(postselectinfo) {
  postselectinfo.userid = store.getters.userid
  return request({
    url: subSysPrefix + '/SystemUser/compositeSelect',
    method: 'post',
    data: postselectinfo
  })
}
// 检索
export function getNoSelectedUsers(data) {
  let searchCon = transformQueryCondition(data)
  delete searchCon.userId
  return request({
    url: subSysPrefix + '/SystemUser/selectNotSelectedUsers',
    method: 'post',
    params: {
      systemId: data.systemId
    },
    data: searchCon
  })
}

// 业务系统与用户关系插入
export function systemUserInsert(postselectinfo) {
  postselectinfo.userid = store.getters.userid
  return request({
    url: subSysPrefix + '/SystemUser',
    method: 'post',
    data: postselectinfo
  })
}

export function systemUserDelete(postselectinfo) {
  // postselectinfo.userid = store.getters.userid
  return request({
    url: subSysPrefix + '/SystemUser/force',
    method: 'DELETE',
    data: postselectinfo
  })
}
